import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/* Layout */
import Layout from "@/layout";

/**
 * Note: 路由配置项
 *
 * hidden: true                     // 当设置 true 的时候该路由不会再侧边栏出现 如401，login等页面，或者如一些编辑页面/edit/1
 * alwaysShow: true                 // 当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式--如组件页面
 *                                  // 只有一个时，会将那个子路由当做根路由显示在侧边栏--如引导页面
 *                                  // 若你想不管路由下面的 children 声明的个数都显示你的根路由
 *                                  // 你可以设置 alwaysShow: true，这样它就会忽略之前定义的规则，一直显示根路由
 * redirect: noRedirect             // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 * name:'router-name'               // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
 * roles: ['admin', 'common']       // 访问路由的角色权限
 * permissions: ['a:a:a', 'b:b:b']  // 访问路由的菜单权限
 * meta : {
    noCache: true                   // 如果设置为true，则不会被 <keep-alive> 缓存(默认 false)
    title: 'title'                  // 设置该路由在侧边栏和面包屑中展示的名字
    icon: 'svg-name'                // 设置该路由的图标，对应路径src/assets/icons/svg
    breadcrumb: false               // 如果设置为false，则不会在breadcrumb面包屑中显示
    activeMenu: '/system/user'      // 当路由设置了该属性，则会高亮相对应的侧边栏。
  }
 */

// 公共路由
export const constantRoutes = [
  {
    path: "/redirect",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "/redirect/:path(.*)",
        component: () => import("@/views/redirect"),
      },
    ],
  },
  {
    path: "/login",
    component: () => import("@/views/login"),
    hidden: true,
  },
  {
    path: "/register",
    component: () => import("@/views/register"),
    hidden: true,
  },
  {
    path: "/404",
    component: () => import("@/views/error/404"),
    hidden: true,
  },
  {
    path: "/401",
    component: () => import("@/views/error/401"),
    hidden: true,
  },
  {
    path: "",
    component: Layout,
    redirect: "index",
    permissions:'0000',
    children: [
      {
        path: "index",
        component: () => import("@/views/index_replace.vue"),
        name: "Index",
        meta: { title: "平台概览", icon: "dashboard", affix: true },
      },
    ],
  },
  {
    name: "AppraiserList",
    path: "/appraiser",
    hidden: false,
    component: Layout,  
    permissions:'5000',
    children:[
      {
        path: "list",
        hidden: false,
        component: () => import("@/views/carsource/appraiser/index.vue"),
        meta: {
          title: "检测师管理",
          icon: "eye-open",
          noCache: true,
          link: null
        }
      },
    ]
  },
  {
    name: "ShopList",
    path: "/shop",
    hidden: false,
    component: Layout,  
    permissions:'2000',
    children:[
      {
        name: "ShopList",
        path: "example",
        hidden: false,
        component: () => import("@/views/carsource/shop/index.vue"),
        meta: {
          title: "门店管理",
          icon: "table",
          noCache: true,
          link: null
        }
      },
    ]
  },
  {
    name: "StoreList",
    path: "/store",
    hidden: false,
    component: Layout,  
    permissions:'2003',
    children:[
      {
        name: "StoreList",
        path: "list",
        hidden: false,
        component: () => import("@/views/carsource/store/index.vue"),
        meta: {
          title: "库存管理",
          icon: "list",
          noCache: true,
          link: null
        }
      },
    ]
  },
  {
    name: "CarSource",
    path: "/carsource",
    hidden: false,
    redirect: "noRedirect",
    component: Layout,
    alwaysShow: true,
    permissions:'7000',
    meta: {
      title: "车源管理",
      icon: "list",
      noCache: true,
      link: null
    },
    children: [      
      {
        name: "StoreList",
        path: "store",
        hidden: false,
        component: () => import("@/views/carsource/store/index.vue"),
        // component: "carsource/store/index",
        meta: {
          title: "库存管理",
          icon: "#",
          noCache: true,
          link: null
        }
      },
      {
        name: "PackageList",
        path: "package",
        hidden: false,
        component: () => import("@/views/carsource/package/index.vue"),
        meta: {
          title: "车包管理",
          icon: "#",
          noCache: true,
          link: null
        }
      },    
      {
        name: "Report",
        path: "report",
        hidden: false,
        component: () => import("@/views/carsource/report/index.vue"),
        meta: {
          title: "分析报表",
          icon: "#",
          noCache: true,
          link: null
        }
      }
    ]
  },
  {
    name: "CarBusiness",
    path: "/carbusiness",
    hidden: false,
    redirect: "noRedirect",
    component: Layout,
    alwaysShow: true,
    permissions:'3000',
    meta: {
      title: "车商管理",
      icon: "list",
      noCache: true,
      link: null
    },
    children: [
      {
        name: "BusinessList",
        path: "business",
        hidden: false,
        component: () => import("@/views/carbusiness/business/index.vue"),
        // component: "carbusiness/business/index",
        meta: {
          title: "车商列表",
          icon: "#",
          noCache: true,
          link: null
        }
      },      
      {
        name: "BusinessRefundList",
        path: "refund",
        hidden: false,
        component: () => import("@/views/carbusiness/refund/index.vue"),
        // component: "carbusiness/business/index",
        meta: {
          title: "车商退款申请",
          icon: "#",
          noCache: true,
          link: null
        }
      },
      {
        name: "Report",
        path: "report",
        hidden: false,
        component: () => import("@/views/carbusiness/report/index.vue"),
        // component: "carbusiness/report/index",
        meta: {
          title: "分析报表",
          icon: "#",
          noCache: true,
          link: null
        }
      },
    ]
  },
  {
    name: "AuctionList",
    path: "/auction",
    hidden: false,
    component: Layout,  
    permissions:'4000',
    children:[
      {
        name: "AuctionList",
        path: "list",
        hidden: false,
        component: () => import("@/views/carsource/auction/index.vue"),
        meta: {
          title: "拍卖管理",
          icon: "list",
          noCache: true,
          link: null
        }
      },
    ]
  },
  {
    name: "AuctionMoney",
    path: "/auctionmoney",
    hidden: false,
    component: Layout,  
    permissions:'6000',
    children:[
      {
        name: "list",
        path: "/auctionmoney/list",        
        noCache: true,
        hidden: false,
        component: () => import("@/views/carbusiness/auctionMoney/index.vue"),
        meta: {
          title: "保证金管理",
          icon: "money",
          noCache: true,
          link: null
        }
      },
    ]
  },  
  {
    name: "User",
    path: "/user",
    hidden: false,
    // redirect: "noRedirect",
    component: Layout,
    alwaysShow: true,
    permissions:'1000',
    meta: {
      title: "用户中心",
      icon: "user",
      noCache: true,
      link: null
    },
    children: [
      {
        name: "UserList",
        path: "userlist",
        hidden: false,
        permissions:'1001',
        component: () => import("@/views/user/list/index.vue"),
        meta: {
          title: "用户管理",
          icon: "#",
          noCache: true,
          link: null
        }
      },
      {
        name: "PartnerList",
        path: "partnerlist",
        hidden: false,
        permissions:'1001',
        component: () => import("@/views/user/partner/index.vue"),
        meta: {
          title: "销售管理",
          icon: "#",
          noCache: true,
          link: null
        }
      },
      {
        name: "Group",
        path: "group",
        hidden: false,
        permissions:'1002',
        component: () => import("@/views/user/group/index.vue"),
        meta: {
          title: "用户组管理",
          icon: "#",
          noCache: true,
          link: null
        }
      }, {
        name: "Permissions",
        path: "permissions",
        hidden: false,
        permissions:'1003',
        component: () => import("@/views/user/permissions/index.vue"),
        meta: {
          title: "权限列表",
          icon: "#",
          noCache: true,
          link: null
        }
      },
    ]
  }
];

// 动态路由，基于用户权限动态去加载
export const dynamicRoutes = [
  // {
  //   path: "/system/user-auth",
  //   component: Layout,
  //   hidden: true,
  //   permissions: ["system:user:edit"],
  //   children: [
  //     {
  //       path: "role/:userId(\\d+)",
  //       component: () => import("@/views/system/user/authRole"),
  //       name: "AuthRole",
  //       meta: { title: "分配角色", activeMenu: "/system/user" },
  //     },
  //   ],
  // },
  // {
  //   path: "/user",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "userlist",
  //       component: () => import("@/views/user/list/index"),
  //       name: "UserList",
  //       meta: { title: "用户列表" },
  //     },
  //   ],
  // },
 
  // {
  //   path: "/system/role-auth",
  //   component: Layout,
  //   hidden: true,
  //   permissions: ["system:role:edit"],
  //   children: [
  //     {
  //       path: "user/:roleId(\\d+)",
  //       component: () => import("@/views/system/role/authUser"),
  //       name: "AuthUser",
  //       meta: { title: "分配用户", activeMenu: "/system/role" },
  //     },
  //   ],
  // },
  // {
  //   path: "/system/dict-data",
  //   component: Layout,
  //   hidden: true,
  //   permissions: ["system:dict:list"],
  //   children: [
  //     {
  //       path: "index/:dictId(\\d+)",
  //       component: () => import("@/views/system/dict/data"),
  //       name: "Data",
  //       meta: { title: "字典数据", activeMenu: "/system/dict" },
  //     },
  //   ],
  // },
  // {
  //   path: "/monitor/job-log",
  //   component: Layout,
  //   hidden: true,
  //   permissions: ["monitor:job:list"],
  //   children: [
  //     {
  //       path: "index/:jobId(\\d+)",
  //       component: () => import("@/views/monitor/job/log"),
  //       name: "JobLog",
  //       meta: { title: "调度日志", activeMenu: "/monitor/job" },
  //     },
  //   ],
  // },
  // {
  //   path: "/tool/gen-edit",
  //   component: Layout,
  //   hidden: true,
  //   permissions: ["tool:gen:edit"],
  //   children: [
  //     {
  //       path: "index/:tableId(\\d+)",
  //       component: () => import("@/views/tool/gen/editTable"),
  //       name: "GenEdit",
  //       meta: { title: "修改生成配置", activeMenu: "/tool/gen" },
  //     },
  //   ],
  // },
  // // TODO:业务中心
  // {
  //   path: "/yardyhq",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "yardyhq",
  //       component: () =>
  //         import(
  //           "@/views/businessCenter/compents/Businessdetails/yardyhq/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "停车记录", activeMenu: "/tool/park/yardyhq" },
  //     },
  //   ],
  // },
  // // TODO: 订单中心
  // {
  //   path: "/businessdetails",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "orderCenter",
  //       component: () =>
  //         import(
  //           "@/views/orderCenter/compents/Businessdetails/PaymentOrder/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "支付订单", activeMenu: "/orderCenter/compents" },
  //     },
  //   ],
  // },
  // {
  //   path: "/trAdeOrder",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "trAdeOrder",
  //       component: () =>
  //         import(
  //           "@/views/orderCenter/compents/Businessdetails/TrAdeOrder/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "线下订单", activeMenu: "/orderCenter/TrAdeOrder" },
  //     },
  //   ],
  // },
  // {
  //   path: "/refundData",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "refundData",
  //       component: () =>
  //         import(
  //           "@/views/Financialcenter/RefundManagement/ApplicationRefund/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "退款申请记录", activeMenu: "/orderCenter/refundData" },
  //     },
  //   ],
  // },
  // {
  //   path: "/newOrderCenter",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "newOrderCenter",
  //       component: () =>
  //         import(
  //           "@/views/orderCenter/compents/Businessdetails/PaymentOrderNews/index"
  //         ),
  //       name: "compents",
  //       meta: {
  //         title: "支付订单新",
  //         activeMenu: "/orderCenter/newOrderCenter",
  //       },
  //     },
  //   ],
  // },
  // {
  //   path: "/newOrderCenter2",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "newOrderCenter2",
  //       component: () =>
  //         import(
  //           "@/views/orderCenter/compents/Businessdetails/PaymentOrderNews/indexNew"
  //         ),
  //       name: "compents",
  //       meta: {
  //         title: "支付订单新",
  //         activeMenu: "/orderCenter/newOrderCenter",
  //       },
  //     },
  //   ],
  // },

  // // TODO:运营中心
  // {
  //   path: "/operate",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "Blacklist",
  //       component: () =>
  //         import(
  //           "@/views/operatingCenter/compents/Businessdetails/Specialvehicle/Blacklist/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "黑名单" },
  //     },
  //   ],
  // },
  // {
  //   path: "/arrearsParking",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "arrearsParking",
  //       component: () =>
  //         import(
  //           "@/views/operatingCenter/compents/Businessdetails/Specialvehicle/arrearsParking/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "欠费车辆", activeMenu: "/orderCenter/newOrderCenter" },
  //     },
  //   ],
  // },
  // {
  //   path: "/zombie",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "zombie",
  //       component: () =>
  //         import(
  //           "@/views/operatingCenter/compents/Businessdetails/yardyhq/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "僵尸车辆", activeMenu: "/orderCenter/newOrderCenter" },
  //     },
  //   ],
  // },
  // {
  //   path: "/CertificateOfwner",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "CertificateOfwner",
  //       component: () =>
  //         import(
  //           "@/views/operatingCenter/compents/Businessdetails/CertificateOfwner/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "车主认证", activeMenu: "/orderCenter/newOrderCenter" },
  //     },
  //   ],
  // },

  // {
  //   path: "/parkData",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "parkData",
  //       component: () =>
  //         import(
  //           "@/views/operatingCenter/compents/Businessdetails/parkData/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "车场数据", activeMenu: "/orderCenter/parkData" },
  //     },
  //   ],
  // },

  // {
  //   path: "/parkOverview",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "parkOverview",
  //       component: () =>
  //         import(
  //           "@/views/operatingCenter/compents/Businessdetails/parkOverview/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "车场概况", activeMenu: "/orderCenter/parkOverview" },
  //     },
  //   ],
  // },

  // // TODO: 运维中心
  // {
  //   path: "/Businessdetails",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "Businessdetails",
  //       component: () =>
  //         import(
  //           "@/views/businessCenter/compents/Businessdetails/yardyhq/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "差异订单", activeMenu: "/orderCenter/Businessdetails" },
  //     },
  //   ],
  // },
  // {
  //   path: "/InterfaceManggment",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "InterfaceManggment",
  //       component: () =>
  //         import(
  //           "@/views/operationsCenter/compents/Interfacedocument/InterfaceManggment/index"
  //         ),
  //       name: "compents",
  //       meta: {
  //         title: "接口文档管理",
  //         activeMenu: "/orderCenter/InterfaceManggment",
  //       },
  //     },
  //   ],
  // },

  // // TODO: 数据中心
  // {
  //   path: "/revenueReconciliation",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "revenueReconciliation",
  //       component: () =>
  //         import(
  //           "@/views/dataCenter/dataTotal/platformData/revenueReconciliation/index"
  //         ),
  //       name: "compents",
  //       meta: {
  //         title: "平台收入对账表",
  //         activeMenu: "/orderCenter/InterfaceManggment",
  //       },
  //     },
  //   ],
  // },
  // {
  //   path: "/businessIncome",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "businessIncome",
  //       component: () =>
  //         import(
  //           "@/views/dataCenter/dataTotal/platformData/businessIncome/index"
  //         ),
  //       name: "compents",
  //       meta: {
  //         title: "平台业务收入表",
  //         activeMenu: "/orderCenter/businessIncome",
  //       },
  //     },
  //   ],
  // },
  // {
  //   path: "/accountBalance",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "accountBalance",
  //       component: () =>
  //         import(
  //           "@/views/dataCenter/dataTotal/platformData/accountBalance/index"
  //         ),
  //       name: "compents",
  //       meta: {
  //         title: "车场收入明细表",
  //         activeMenu: "/orderCenter/accountBalance",
  //       },
  //     },
  //   ],
  // },
  // {
  //   path: "/etcIncomeBreakdown",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "etcIncomeBreakdown",
  //       component: () =>
  //         import(
  //           "@/views/dataCenter/dataTotal/platformData/etcIncomeBreakdown/index"
  //         ),
  //       name: "compents",
  //       meta: {
  //         title: "ETC收入明细表",
  //         activeMenu: "/orderCenter/etcIncomeBreakdown",
  //       },
  //     },
  //   ],
  // },
  // {
  //   path: "/comprehensive",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "comprehensive",
  //       component: () =>
  //         import(
  //           "@/views/dataCenter/dataTotal/platformData/comprehensive/index"
  //         ),
  //       name: "compents",
  //       meta: {
  //         title: "综合统计报表",
  //         activeMenu: "/orderCenter/comprehensive",
  //       },
  //     },
  //   ],
  // },
  // // TODO: 财务中心
  // {
  //   path: "/AuditRefund",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "AuditRefund",
  //       component: () =>
  //         import("@/views/Financialcenter/RefundManagement/AuditRefund/index"),
  //       name: "compents",
  //       meta: { title: "退款审核记录", activeMenu: "/orderCenter/AuditRefund" },
  //     },
  //   ],
  // },
  // {
  //   path: "/ConfirmationRefund",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "ConfirmationRefund",
  //       component: () =>
  //         import(
  //           "@/views/Financialcenter/RefundManagement/ConfirmationRefund/index"
  //         ),
  //       name: "compents",
  //       meta: {
  //         title: "退款确认记录",
  //         activeMenu: "/orderCenter/ConfirmationRefund",
  //       },
  //     },
  //   ],
  // },
  // {
  //   path: "/refundSuccess",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "refundSuccess",
  //       component: () =>
  //         import(
  //           "@/views/Financialcenter/RefundManagement/refundSuccess/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "已退款列表", activeMenu: "/orderCenter/refundSuccess" },
  //     },
  //   ],
  // },
  // {
  //   path: "/refundSuccessNew",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "refundSuccessNew",
  //       component: () =>
  //         import(
  //           "@/views/Financialcenter/RefundManagement/refundSuccess/indexNew"
  //         ),
  //       name: "compents",
  //       meta: { title: "已退款列表", activeMenu: "/orderCenter/refundSuccessNew" },
  //     },
  //   ],
  // },
  // {
  //   path: "/CarRevenueStatistics",
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: "CarRevenueStatistics",
  //       component: () =>
  //         import("@/views/Financialcenter/parkBill/CarRevenueStatistics/index"),
  //       name: "compents",
  //       meta: {
  //         title: "车场收入统计",
  //         activeMenu: "/orderCenter/refundSuccess",
  //       },
  //     }, {
  //       path: "CarRevenueStatisticsNew",
  //       component: () =>
  //         import("@/views/Financialcenter/parkBill/CarRevenueStatistics/indexNew"),
  //       name: "compents",
  //       meta: {
  //         title: "车场收入统计(新)",
  //         activeMenu: "/orderCenter/refundSuccess",
  //       },
  //     },
  //   ],
  // },

  // // TODO: 客服中心
  // {
  //   path: "/OpinionFeedback",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "OpinionFeedback",
  //       component: () =>
  //         import(
  //           "@/views/serviceCenter/compents/Businessdetails/OpinionFeedback/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "意见反馈" },
  //     },
  //     {
  //       path: "notice",
  //       component: () =>
  //         import(
  //           "@/views/serviceCenter/compents/Businessdetails/Notice/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "公告管理" },
  //     }, {
  //       path: "addOwnerCertification",
  //       component: () =>
  //         import(
  //           "@/views/serviceCenter/compents/Businessdetails/OwnerCertification/Add"
  //         ),
  //       name: "compents",
  //       meta: { title: "提交车主认证" },
  //     },
  //   ],
  // },

  // // TODO: 管理中心

  // {
  //   path: "/ledger",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "ledger",
  //       component: () =>
  //         import(
  //           "@/views/managementCenter/compents/Businessdetails/yardyhq/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "分账配置" },
  //     },
  //   ],
  // },
  // {
  //   path: "/refund",
  //   component: Layout,
  //   hidden: true,
  //   permissions: ["tool:gen:edit"],
  //   children: [
  //     {
  //       path: "orderCenter",
  //       component: () =>
  //         import(
  //           "@/views/orderCenter/compents/Businessdetails/PaymentOrder/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "财务中心", activeMenu: "/orderCenter/compents" },
  //     },
  //   ],
  // },
  // // TODO: 车场券
  // {
  //   path: "/coupon1",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "coupon1",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/parkingcoupons/Couponmanagement/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "优惠券管理", activeMenu: "/orderCenter/compents" },
  //     },
  //   ],
  // },
  // {
  //   path: "/parkStock",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "parkStock",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/parkingcoupons/CouponStockMent/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "优惠券库存管理" },
  //     },
  //   ],
  // },
  // {
  //   path: "/parkBuy",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "parkBuy",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/parkingcoupons/CouponPurchaseHistory/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "优惠券购买记录" },
  //     },
  //   ],
  // },
  // {
  //   path: "/parkGrant",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "/parkGrant",
  //       component: () =>
  //         import("@/views/Marketingcenter/parkingcoupons/CouponGrant/index"),
  //       name: "compents",
  //       meta: { title: "优惠券发放明细" },
  //     },
  //   ],
  // },
  // {
  //   path: "/parkWriteOff",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "parkWriteOff",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/parkingcoupons/CouponVerification/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "优惠券核销明细" },
  //     },
  //   ],
  // },
  // {
  //   path: "/parkAudit",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "parkAudit",
  //       component: () =>
  //         import("@/views/Marketingcenter/parkingcoupons/CouponAudit/index"),
  //       name: "compents",
  //       meta: { title: "优惠券审核" },
  //     },
  //   ],
  // },
  // // TODO: 商家管理
  // {
  //   path: "/Businessinfo",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "Businessinfo",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/Businessmanagement/Businessinformation/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "商家信息管理" },
  //     },
  //   ],
  // },
  // {
  //   path: "/Businessaccount",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "Businessaccount",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/Businessmanagement/Businessaccount/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "商家账号管理" },
  //     },
  //   ],
  // },
  // {
  //   path: "/Businessbalance",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "Businessbalance",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/Businessmanagement/Businessbalance/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "商家余额管理" },
  //     },
  //   ],
  // },
  // {
  //   path: "/Businesstrading",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "Businesstrading",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/Businessmanagement/Businesstrading/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "商家交易记录" },
  //     },
  //   ],
  // },
  // {
  //   path: "/Businessrecharge",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "Businessrecharge",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/Businessmanagement/Businessrecharge/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "商家充值记录" },
  //     },
  //   ],
  // },
  // {
  //   path: "/Businessinventory",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "parkAudit",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/Businessmanagement/Businessinventory/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "商家优惠券库存" },
  //     },
  //   ],
  // },
  // {
  //   path: "/Businessdiscount",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "Businessdiscount",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/Businessmanagement/Businessdiscount/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "商家充值折扣" },
  //     },
  //   ],
  // },
  // {
  //   path: "/parkAudit",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "parkAudit",
  //       component: () => import("@/views/Marketingcenter/Process/index"),
  //       name: "compents",
  //       meta: { title: "商家充值审核" },
  //     },
  //   ],
  // },

  // //TODO: 平台优惠券
  // {
  //   path: "/platformCoupon1",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "platformCoupon1",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/PlatformCoupons/Couponmanagement/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "优惠券管理" },
  //     },
  //   ],
  // },
  // {
  //   path: "/platformStock",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "platformStock",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/PlatformCoupons/CouponStockMent/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "优惠券库存管理" },
  //     },
  //   ],
  // },
  // {
  //   path: "/platformPurchase",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "platformPurchase",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/PlatformCoupons/CouponPurchaseHistory/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "优惠券购买记录" },
  //     },
  //   ],
  // },
  // {
  //   path: "/platformGrant",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "platformGrant",
  //       component: () =>
  //         import("@/views/Marketingcenter/PlatformCoupons/CouponGrant/index"),
  //       name: "compents",
  //       meta: { title: "优惠券发放明细" },
  //     },
  //   ],
  // },
  // {
  //   path: "/platformVerification",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "platformVerification",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/PlatformCoupons/CouponVerification/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "优惠券核销明细" },
  //     },
  //   ],
  // },
  // //TODO: 月卡
  // {
  //   path: "/MonthCarMangement",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "MonthCarMangement",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/MonthCardCenter/MonthCarMangement/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "会员开通记录" },
  //     },
  //   ],
  // },
  // {
  //   path: "/MonthlyCarMangment",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "MonthlyCarMangment",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/MonthCardCenter/MonthlyCarMangment/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "会员操作记录" },
  //     },
  //   ],
  // },
  // {
  //   path: "/MontnlyCarconfiguration",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "MontnlyCarconfiguration",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/MonthCardCenter/MontnlyCarconfiguration/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "月卡配置" },
  //     },
  //   ],
  // },
  // {
  //   path: "/MontnlyCarmanagement",
  //   component: Layout,
  //   hidden: true,
  //   //permissions: ['tool:gen:edit'],
  //   children: [
  //     {
  //       path: "MontnlyCarmanagement",
  //       component: () =>
  //         import(
  //           "@/views/Marketingcenter/MonthCardCenter/MontnlyCarmanagement/index"
  //         ),
  //       name: "compents",
  //       meta: { title: "月租车管理" },
  //     },
  //   ],
  // },
];

export const testRoutes = [
  // {
  //   name:'CarSource',
  //   path: "/carsource",
  //   component: Layout,
  //   hidden: false,
  //   redirect:'noRedirect',
  //   alwaysShow: true,
  //   meta: { title: "车源管理", icon: "list", noCache: true, link: null },
  //   children: [
  //     {
  //       path: "shop",
  //       component: "carsource/shop/index",
  //       name: "ShopList",
  //       meta: { title: "门店管理", icon: "dashboard" },
  //     },
  //     {
  //       path: "index",
  //       component: () => import("@/views/index_replace.vue"),
  //       name: "IndexReplace",
  //       meta: { title: "库存管理", icon: "dashboard" },
  //     },
  //     {
  //       path: "index",
  //       component: () => import("@/views/index_replace.vue"),
  //       name: "IndexReplace",
  //       meta: { title: "分析报表", icon: "dashboard" },
  //     }
  //   ],
  // },{
  //   path: "/carbusiness",
  //   component: Layout,
  //   hidden: false,
  //   alwaysShow: true,
  //   meta: { title: "车商管理", icon: "list", noCache: true, link: null },
  //   children: [
  //     {
  //       path: "index",
  //       component: () => import("@/views/index_replace.vue"),
  //       name: "IndexReplace",
  //       meta: { title: "车商列表", icon: "dashboard" },
  //     },
  //     {
  //       path: "index",
  //       component: () => import("@/views/index_replace.vue"),
  //       name: "IndexReplace",
  //       meta: { title: "分析报表", icon: "dashboard" },
  //     },
  //   ]
  // }
];

// 防止连续点击多次路由报错
let routerPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch((err) => err);
};

export default new Router({
  //mode: 'history', // 去掉url中的#
  mode: "hash", // #号后的所有内容都被当做参数使用，而不是url
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes,
});
